package com.zlp.netty.component;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.*;

/**
 * @author: zhulaiping
 * @time: 2022/9/1 13:36
 */
@Slf4j
public class JdkFutureDemo {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        ExecutorService service = Executors.newFixedThreadPool(2);
        Future<Integer> future = service.submit(() -> {
            log.debug("执行计算。。。");
            Thread.sleep(1000);
            return 50;
        });

        log.debug("等待结果，，，：");
        //阻塞获取
        //log.debug("结果是：{}",future.get());
    }
}
